<template>
  <div>
    <div>09$provide与$inject</div>
    <div>爷爷的钱，{{ money }}</div>
    <div>爷爷的车，{{ car }}</div>
    <father />
  </div>
</template>

<script lang="ts" setup>
import { provide, ref } from 'vue'
import father from "./father.vue"

let money = ref(1000)
let car = ref({ name: "本田", price: 2000 })

function addGrandFaMoney(value: number) {
  money.value += value
}

provide('moneyContext', { money, addGrandFaMoney })
provide('carContext', car)
</script>

<style lang="scss" scoped>

</style>